<?php 
include "secretiki.php";

if ( isset($_GET['id']) ) {
	$query = "SELECT * FROM tovars WHERE id=" . $_GET['id'];

	$req = mysqli_query($connection, $query);
	$current_course = mysqli_fetch_assoc($req);
	// var_dump($current_course);

	if (empty($current_course)) {
		header("Location: 404.php");
	}
}

?>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="author" content="Roman Shangin">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>Асик - сервисный центр</title>
    <!-- Fevicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico">
    <!-- Start css -->
    <!-- Switchery css -->
    <link href="index/assets/plugins/switchery/switchery.min.css" rel="stylesheet">
    <!-- Slick css -->
    <link href="index/assets/plugins/slick/slick.css" rel="stylesheet">
    <link href="index/assets/plugins/slick/slick-theme.css" rel="stylesheet">    
    <link href="index/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="index/assets/css/icons.css" rel="stylesheet" type="text/css">
    <link href="index/assets/css/flag-icon.min.css" rel="stylesheet" type="text/css">
    <link href="index/assets/css/style.css" rel="stylesheet" type="text/css">
    <!-- End css -->
</head>

<?php
include "body-head.php";
?>

            <!-- Start Contentbar -->    
            <div class="contentbar">                
                <!-- Start row -->
                <div class="row">
                    <!-- Start col -->
                    <div class="col-md-12 col-lg-12 col-xl-12">
                        <div class="card m-b-30">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-lg-6 col-xl-5">
                                        <div class="product-slider-box product-box-for">
                                            <div class="product-preview">
                                                <img src="adm/assets/images/<?php echo $current_course['photo_tovar']?>" class="img-fluid" alt="Product">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-lg-6 col-xl-7">
                                           <?php      if ($current_course['new_tovar'] == '1') : ?>
                                                   <p><span class='badge badge-danger font-16'>Новинка</span></p>
                                            <?php     else : ?>
                                            <?php         if ($current_course['sale_tovar'] == '1') : ?>
                                                  <p><span class='badge badge-warning font-16'>Акция</span></p>
                                             <?php        else :
                                                    endif; 
                                                endif;?>
                                        <h2 class="font-22"><?php echo $current_course['name_tovar']?></h2>
                                        <p class="text-primary font-26 f-w-7 my-3"><?php echo $current_course['price_tovar']?> ₽</p>
                                        <p class="mb-4"><pre style="font-family: Arial; font-size: 13pt;"><?php echo $current_course['desc_tovar']?></pre></p>                                        

                                        <div class="button-list mt-5 mb-5">
                                            <a href="shop" class="btn btn-primary-rgba font-18"><i class="feather icon-arrow-left"></i>Назад</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- End col -->
                </div>
                <!-- End row -->
                <!-- Start row -->
                <div class="row">
                    <!-- Start col -->
                    <div class="col-lg-12">
                        <div class="card m-b-30">
                            <div class="card-body">
                                <ul class="nav nav-tabs custom-tab-line mb-3" id="defaultTabLine" role="tablist">
                                    <li class="nav-item">
                                        <a class="nav-link active" id="description-tab-line" data-toggle="tab" href="#description-line" role="tab" aria-controls="description-line" aria-selected="true"><i class="feather icon-file-text mr-2"></i>Описание</a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link" id="guide-tab-line" data-toggle="tab" href="#guide-line" role="tab" aria-controls="guide-line" aria-selected="false"><i class="feather icon-book-open mr-2"></i>Руководство</a>
                                    </li>
                                </ul>
                                <div class="tab-content" id="defaultTabContentLine">
                                    <div class="tab-pane fade show active" id="description-line" role="tabpanel" aria-labelledby="description-tab-line">
                                      <p><pre style="font-family: Arial; font-size: 13pt;"><?php echo $current_course['info_tovar']?></pre></p>
                                    </div>
                                    <div class="tab-pane fade" id="guide-line" role="tabpanel" aria-labelledby="guide-tab-line">
                                        <ul>
                                            <?php	if ($current_course['video_tovar'] != '') :?>
                                            <iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $current_course['video_tovar']?>?controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                                            <?php else : ?>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>                    
                    <!-- End col -->
                </div>
                <!-- End row -->
            </div>
            <!-- End Contentbar -->
            <!-- Start Footerbar -->
            <div class="footerbar">
                <footer class="footer">
                    <p class="mb-0">© 2022 Асик - Все права защищены.</p>
                </footer>
            </div>
            <!-- End Footerbar -->
        </div>
        <!-- End Rightbar -->
    </div>
    <!-- End Containerbar -->
    <!-- Start js -->        
    <script src="index/assets/js/jquery.min.js"></script>
    <script src="index/assets/js/popper.min.js"></script>
    <script src="index/assets/js/bootstrap.min.js"></script>
    <script src="index/assets/js/modernizr.min.js"></script>
    <script src="index/assets/js/detect.js"></script>
    <script src="index/assets/js/jquery.slimscroll.js"></script>
    <script src="index/assets/js/horizontal-menu.js"></script>
    <!-- Switchery js -->
    <script src="index/assets/plugins/switchery/switchery.min.js"></script>
    <!-- Slick js -->
    <script src="index/assets/plugins/slick/slick.min.js"></script>
    <script src="index/assets/js/custom/custom-ecommerce-single-product.js"></script>
    <!-- Core js -->
    <script src="index/assets/js/core.js"></script>
    <!-- End js -->
</body>
</html>
